package com.sand.controller;

import com.sand.dto.worker.SalaryFa;
import com.sand.dto.worker.SelectSalary;
import com.sand.entity.work.Salary;
import com.sand.result.ResponseResult;
import com.sand.service.SalaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


//工资接口
@RestController
@RequestMapping("/salary")
public class SalaryController {

    @Autowired
    private SalaryService service;

    /**
     * 发放工资
     */
    @PostMapping("/fa")
    private ResponseResult<Integer> fa(@RequestBody SalaryFa salaryFa){
       Integer i =  service.fa(salaryFa);
        return new ResponseResult<Integer>().ok(i);
    }


    /**
     *
     * 条件查询工人的工资情况
     */
    @PostMapping("/list")
    private ResponseResult<List<Salary>> all(@RequestBody SelectSalary selectSalary){
        List<Salary> list = service.all(selectSalary);
        return new ResponseResult<List<Salary>>().ok(list);
    }

}
